/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Presentacion;

import Datos.Conexion;
import Datos.*;
import Killer.*;
import Negocio.*;
import VisorImagenes.frmVisor;
import java.awt.Color;
import java.awt.Image;
import java.io.File;
import java.util.ArrayList;
import javax.swing.ImageIcon;
import javax.swing.JFileChooser;
import javax.swing.filechooser.FileNameExtensionFilter;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author Pedro
 */
public class frmReceta extends javax.swing.JDialog implements Runnable {

    Conexion con = new Conexion();
    public static int IdRecetaSimple, fila;
    public static boolean hiloHabilitado, isHabilitado = false;
    public static float costoTotal = 0;
    public static float valorProteico = 0;
    //-------------------------------------------------------------------------------------------//
    public static JFileChooser buscar;
    private FileNameExtensionFilter filter;
    public static ArrayList direcciones, listaNombre;
    private Thread hilo;
    //-------------------------------------------------------------------------------------------//

    public frmReceta(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        this.setTitle("Receta");
        this.setLocationRelativeTo(null);
        this.lblVerImagenes.setText("<html><u>Ver imagenes de la receta</u></html>!");
        this.lblCargarImagenes.setText("<html><u>agregar imagenes</u></html>!");
        this.lblRecetasInhabilitada.setText("<html><u>Ver recetas deshabilitadas</u></html>!");
        //------------------------------------------------------------------------------//
        buscar = new JFileChooser();
        filter = new FileNameExtensionFilter("JPG & PNG", "jpg", "gif", "png", "bmp");
        buscar.setFileFilter(filter);
        buscar.setMultiSelectionEnabled(true);
        direcciones = new ArrayList();
        listaNombre = new ArrayList();
        hilo = new Thread(this, "");
        hilo.start();
        hiloHabilitado = false;
        //------------------------------------------------------------------------------//

        this.deshabilitarCampos();
        btnGuardar.setEnabled(false);
        btnModificar.setEnabled(false);
        btnEliminar.setEnabled(false);
        btnCancelar.setEnabled(false);
        this.hacerVisibleCamposObligatorios();
        this.cargarTablaReceta(); // se cargar todas las recetas q se encuentran en la BD
        this.cargarCbxBuscador();  //carga el cbx con los tipos de receta
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        panel1 = new org.edisoncor.gui.panel.Panel();
        jPanel1 = new javax.swing.JPanel();
        label1 = new javax.swing.JLabel();
        txtNombre = new javax.swing.JTextField();
        txtPorciones = new javax.swing.JTextField();
        cbxTipoReceta = new javax.swing.JComboBox();
        label3 = new javax.swing.JLabel();
        label2 = new javax.swing.JLabel();
        label4 = new javax.swing.JLabel();
        label5 = new javax.swing.JLabel();
        label6 = new javax.swing.JLabel();
        lblModeloReceta = new javax.swing.JLabel();
        lblCostoReceta = new javax.swing.JLabel();
        lblValorProteico = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        pnlPreparacion = new javax.swing.JTextPane();
        lblObligatorio1 = new javax.swing.JLabel();
        lblObligatorio3 = new javax.swing.JLabel();
        lblObligatorio2 = new javax.swing.JLabel();
        cbxIngrediente = new javax.swing.JComboBox();
        btnAgregarIngrediente = new javax.swing.JButton();
        btnAgregarTipoReceta = new javax.swing.JButton();
        lblCargarImagenes = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        lblVerImagenes = new javax.swing.JLabel();
        lblRecetasInhabilitada = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        cbxComplementario = new javax.swing.JComboBox();
        btnAgregarComplementaria = new javax.swing.JButton();
        jLabel5 = new javax.swing.JLabel();
        cbxUnidad = new javax.swing.JComboBox();
        jPanel3 = new javax.swing.JPanel();
        ToolBarAcciones = new javax.swing.JToolBar();
        btnNuevo = new javax.swing.JButton();
        btnModificar = new javax.swing.JButton();
        btnGuardar = new javax.swing.JButton();
        btnEliminar = new javax.swing.JButton();
        btnCancelar = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        tbRecetas = new javax.swing.JTable();
        jPanel4 = new javax.swing.JPanel();
        cbxBuscador = new javax.swing.JComboBox();
        txtBuscador = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setResizable(false);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                CerrarVentanaReceta(evt);
            }
        });

        panel1.setColorPrimario(new java.awt.Color(153, 255, 153));
        panel1.setColorSecundario(new java.awt.Color(153, 255, 153));

        jPanel1.setBackground(new java.awt.Color(153, 255, 153));
        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Datos relacionados a la receta", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.TOP, new java.awt.Font("Cambria", 1, 14))); // NOI18N
        jPanel1.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                jPanel1MouseMoved(evt);
            }
        });

        label1.setFont(new java.awt.Font("Cambria", 0, 14)); // NOI18N
        label1.setText("Nombre :");

        txtNombre.setFont(new java.awt.Font("Cambria", 0, 14)); // NOI18N
        txtNombre.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txtNombreKeyTyped(evt);
            }
        });

        txtPorciones.setFont(new java.awt.Font("Cambria", 0, 14)); // NOI18N
        txtPorciones.setText("0");
        txtPorciones.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                txtPorcionesMouseClicked(evt);
            }
        });
        txtPorciones.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txtPorcionesKeyTyped(evt);
            }
        });

        cbxTipoReceta.setFont(new java.awt.Font("Cambria", 0, 14)); // NOI18N

        label3.setFont(new java.awt.Font("Cambria", 0, 14)); // NOI18N
        label3.setText("Tipo Receta:");

        label2.setFont(new java.awt.Font("Cambria", 0, 14)); // NOI18N
        label2.setText("Rendimiento:");

        label4.setFont(new java.awt.Font("Cambria", 0, 14)); // NOI18N
        label4.setText("Modelo de Receta:      ");

        label5.setFont(new java.awt.Font("Cambria", 0, 14)); // NOI18N
        label5.setText("Costo  Receta : ");

        label6.setFont(new java.awt.Font("Cambria", 0, 14)); // NOI18N
        label6.setText("Valor Proteico (total):");

        lblModeloReceta.setFont(new java.awt.Font("Cambria", 0, 14)); // NOI18N

        lblCostoReceta.setFont(new java.awt.Font("Cambria", 0, 14)); // NOI18N
        lblCostoReceta.setText(" ");

        lblValorProteico.setFont(new java.awt.Font("Cambria", 0, 14)); // NOI18N
        lblValorProteico.setText(" ");

        jLabel2.setFont(new java.awt.Font("Cambria", 0, 14)); // NOI18N
        jLabel2.setText("Ingredientes:");

        jLabel3.setFont(new java.awt.Font("Cambria", 0, 14)); // NOI18N
        jLabel3.setText("Preparacion:");

        jScrollPane2.setBackground(new java.awt.Color(0, 102, 51));

        pnlPreparacion.setBackground(new java.awt.Color(0, 102, 51));
        pnlPreparacion.setBorder(null);
        pnlPreparacion.setFont(new java.awt.Font("Garamond", 0, 14)); // NOI18N
        pnlPreparacion.setSelectedTextColor(new java.awt.Color(0, 0, 0));
        pnlPreparacion.setSelectionColor(new java.awt.Color(153, 255, 153));
        pnlPreparacion.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                pnlPreparacionKeyTyped(evt);
            }
        });
        jScrollPane2.setViewportView(pnlPreparacion);

        lblObligatorio1.setFont(new java.awt.Font("Cambria", 1, 14)); // NOI18N
        lblObligatorio1.setForeground(new java.awt.Color(255, 0, 0));
        lblObligatorio1.setText("*");

        lblObligatorio3.setFont(new java.awt.Font("Cambria", 1, 14)); // NOI18N
        lblObligatorio3.setForeground(new java.awt.Color(255, 0, 0));
        lblObligatorio3.setText("*");

        lblObligatorio2.setFont(new java.awt.Font("Cambria", 1, 14)); // NOI18N
        lblObligatorio2.setForeground(new java.awt.Color(255, 0, 0));
        lblObligatorio2.setText("*");

        cbxIngrediente.setFont(new java.awt.Font("Cambria", 0, 14)); // NOI18N

        btnAgregarIngrediente.setFont(new java.awt.Font("Cambria", 0, 14)); // NOI18N
        btnAgregarIngrediente.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/agregarT.png"))); // NOI18N
        btnAgregarIngrediente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAgregarIngredienteActionPerformed(evt);
            }
        });

        btnAgregarTipoReceta.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/agregarT.png"))); // NOI18N
        btnAgregarTipoReceta.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAgregarTipoRecetaActionPerformed(evt);
            }
        });

        lblCargarImagenes.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        lblCargarImagenes.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/picture2.png"))); // NOI18N
        lblCargarImagenes.setText("agregar imagen");
        lblCargarImagenes.setToolTipText("");
        lblCargarImagenes.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        lblCargarImagenes.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        lblCargarImagenes.setDoubleBuffered(true);
        lblCargarImagenes.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        lblCargarImagenes.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        lblCargarImagenes.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                lblCargarImagenesMouseClicked(evt);
            }
        });
        lblCargarImagenes.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                lblCargarImagenesMouseMoved(evt);
            }
        });

        jPanel2.setBackground(new java.awt.Color(153, 255, 153));
        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Opciones", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.TOP, new java.awt.Font("Cambria", 0, 12))); // NOI18N

        lblVerImagenes.setFont(new java.awt.Font("Cambria", 1, 12)); // NOI18N
        lblVerImagenes.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        lblVerImagenes.setText("Ver imagenes de la receta");
        lblVerImagenes.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        lblVerImagenes.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        lblVerImagenes.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                lblVerImagenesMouseClicked(evt);
            }
        });
        lblVerImagenes.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                lblVerImagenesMouseMoved(evt);
            }
        });

        lblRecetasInhabilitada.setFont(new java.awt.Font("Cambria", 1, 12)); // NOI18N
        lblRecetasInhabilitada.setText("Ver recetas deshabilitadas");
        lblRecetasInhabilitada.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        lblRecetasInhabilitada.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                lblRecetasInhabilitadaMouseClicked(evt);
            }
        });
        lblRecetasInhabilitada.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                lblRecetasInhabilitadaMouseMoved(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(lblVerImagenes, javax.swing.GroupLayout.PREFERRED_SIZE, 154, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblRecetasInhabilitada))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addComponent(lblVerImagenes, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblRecetasInhabilitada, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(13, Short.MAX_VALUE))
        );

        jLabel4.setFont(new java.awt.Font("Cambria", 0, 14)); // NOI18N
        jLabel4.setText("Recetas complementarias:");

        cbxComplementario.setFont(new java.awt.Font("Cambria", 0, 14)); // NOI18N

        btnAgregarComplementaria.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/agregarT.png"))); // NOI18N
        btnAgregarComplementaria.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAgregarComplementariaActionPerformed(evt);
            }
        });

        jLabel5.setFont(new java.awt.Font("Cambria", 0, 14)); // NOI18N
        jLabel5.setText("Unidad:");

        cbxUnidad.setFont(new java.awt.Font("Cambria", 0, 14)); // NOI18N
        cbxUnidad.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Porciones", "Kilogramos", "Litros", "Gramos", "MiliLitro" }));

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanel1Layout.createSequentialGroup()
                                        .addComponent(label1)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(lblObligatorio1))
                                    .addComponent(label3)
                                    .addComponent(label2, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(74, 74, 74)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanel1Layout.createSequentialGroup()
                                        .addComponent(cbxTipoReceta, javax.swing.GroupLayout.PREFERRED_SIZE, 213, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(btnAgregarTipoReceta, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                        .addGroup(jPanel1Layout.createSequentialGroup()
                                            .addComponent(txtPorciones, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(jLabel5)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(cbxUnidad, javax.swing.GroupLayout.PREFERRED_SIZE, 152, javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addGroup(jPanel1Layout.createSequentialGroup()
                                            .addComponent(cbxIngrediente, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addGap(5, 5, 5)
                                            .addComponent(btnAgregarIngrediente, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addComponent(txtNombre)))
                                .addGap(18, 18, 18)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(label6)
                                        .addComponent(label4))
                                    .addComponent(label5, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(jLabel2)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(lblObligatorio2)))
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGap(16, 16, 16)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(lblValorProteico, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblCostoReceta, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGap(18, 18, 18)
                                .addComponent(lblModeloReceta, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(lblCargarImagenes, javax.swing.GroupLayout.PREFERRED_SIZE, 203, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel4)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(jLabel3)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(lblObligatorio3)))
                        .addGap(14, 14, 14)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(cbxComplementario, javax.swing.GroupLayout.PREFERRED_SIZE, 195, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btnAgregarComplementaria, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(0, 0, Short.MAX_VALUE))
                            .addComponent(jScrollPane2))
                        .addGap(18, 18, 18)
                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(109, 109, 109))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(btnAgregarIngrediente)
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(txtNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(label1)
                                .addComponent(lblObligatorio1)
                                .addComponent(label4))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(label2)
                                .addComponent(txtPorciones, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(label5)
                                .addComponent(lblCostoReceta, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel5)
                                .addComponent(cbxUnidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(label3)
                                    .addComponent(cbxTipoReceta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addComponent(btnAgregarTipoReceta)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(label6)
                                    .addComponent(lblValorProteico)))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel2)
                                .addComponent(lblObligatorio2)
                                .addComponent(cbxIngrediente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addComponent(lblCargarImagenes, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(lblModeloReceta, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGap(106, 106, 106)))
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(11, 11, 11)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel3)
                            .addComponent(lblObligatorio3))
                        .addGap(85, 85, 85))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addGap(12, 12, 12)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 10, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(btnAgregarComplementaria)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(cbxComplementario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel4)))
                .addContainerGap(22, Short.MAX_VALUE))
        );

        jPanel3.setBackground(new java.awt.Color(0, 204, 51));

        ToolBarAcciones.setBackground(new java.awt.Color(0, 204, 51));
        ToolBarAcciones.setFloatable(false);
        ToolBarAcciones.setOrientation(javax.swing.SwingConstants.VERTICAL);
        ToolBarAcciones.setRollover(true);
        ToolBarAcciones.setFont(new java.awt.Font("Cambria", 0, 14)); // NOI18N

        btnNuevo.setBackground(new java.awt.Color(255, 255, 255));
        btnNuevo.setFont(new java.awt.Font("Cambria", 1, 14)); // NOI18N
        btnNuevo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/add.png"))); // NOI18N
        btnNuevo.setText("Nuevo");
        btnNuevo.setFocusable(false);
        btnNuevo.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnNuevo.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnNuevo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnNuevoActionPerformed(evt);
            }
        });
        ToolBarAcciones.add(btnNuevo);

        btnModificar.setBackground(new java.awt.Color(255, 255, 255));
        btnModificar.setFont(new java.awt.Font("Cambria", 1, 14)); // NOI18N
        btnModificar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/refresh.png"))); // NOI18N
        btnModificar.setText("Modificar");
        btnModificar.setFocusable(false);
        btnModificar.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnModificar.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnModificar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnModificarActionPerformed(evt);
            }
        });
        ToolBarAcciones.add(btnModificar);

        btnGuardar.setBackground(new java.awt.Color(255, 255, 255));
        btnGuardar.setFont(new java.awt.Font("Cambria", 1, 14)); // NOI18N
        btnGuardar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/save.png"))); // NOI18N
        btnGuardar.setText("Guardar");
        btnGuardar.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        btnGuardar.setFocusable(false);
        btnGuardar.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnGuardar.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnGuardar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnGuardarActionPerformed(evt);
            }
        });
        ToolBarAcciones.add(btnGuardar);

        btnEliminar.setFont(new java.awt.Font("Cambria", 1, 14)); // NOI18N
        btnEliminar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/delete.png"))); // NOI18N
        btnEliminar.setText("Eliminar");
        btnEliminar.setFocusable(false);
        btnEliminar.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnEliminar.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnEliminar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnEliminarActionPerformed(evt);
            }
        });
        ToolBarAcciones.add(btnEliminar);

        btnCancelar.setFont(new java.awt.Font("Cambria", 1, 14)); // NOI18N
        btnCancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/remove.png"))); // NOI18N
        btnCancelar.setText("Cancelar");
        btnCancelar.setFocusable(false);
        btnCancelar.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnCancelar.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCancelarActionPerformed(evt);
            }
        });
        ToolBarAcciones.add(btnCancelar);

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(ToolBarAcciones, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addComponent(ToolBarAcciones, javax.swing.GroupLayout.PREFERRED_SIZE, 601, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
        );

        tbRecetas.setBackground(new java.awt.Color(204, 255, 204));
        tbRecetas.setFont(new java.awt.Font("Cambria", 0, 14)); // NOI18N
        tbRecetas.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "idReceta", "Receta", "Tipo Receta", "preparacion", "Costo Total", "Valor Proteico", "Rendimiento", "Modelo", "fechaEliminada", "null", "Unidad"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Boolean.class, java.lang.Object.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false, false, false, false, false, true, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tbRecetas.setGridColor(new java.awt.Color(0, 0, 204));
        tbRecetas.setRowHeight(20);
        tbRecetas.setSelectionBackground(new java.awt.Color(51, 255, 102));
        tbRecetas.setSelectionForeground(new java.awt.Color(0, 0, 0));
        tbRecetas.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        tbRecetas.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tbRecetasMouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(tbRecetas);
        tbRecetas.getColumnModel().getColumn(0).setMinWidth(0);
        tbRecetas.getColumnModel().getColumn(0).setPreferredWidth(0);
        tbRecetas.getColumnModel().getColumn(0).setMaxWidth(0);
        tbRecetas.getColumnModel().getColumn(1).setPreferredWidth(150);
        tbRecetas.getColumnModel().getColumn(2).setPreferredWidth(50);
        tbRecetas.getColumnModel().getColumn(3).setMinWidth(0);
        tbRecetas.getColumnModel().getColumn(3).setPreferredWidth(0);
        tbRecetas.getColumnModel().getColumn(3).setMaxWidth(0);
        tbRecetas.getColumnModel().getColumn(4).setPreferredWidth(30);
        tbRecetas.getColumnModel().getColumn(5).setPreferredWidth(30);
        tbRecetas.getColumnModel().getColumn(6).setPreferredWidth(20);
        tbRecetas.getColumnModel().getColumn(7).setPreferredWidth(50);
        tbRecetas.getColumnModel().getColumn(8).setMinWidth(0);
        tbRecetas.getColumnModel().getColumn(8).setPreferredWidth(0);
        tbRecetas.getColumnModel().getColumn(8).setMaxWidth(0);
        tbRecetas.getColumnModel().getColumn(9).setMinWidth(0);
        tbRecetas.getColumnModel().getColumn(9).setPreferredWidth(0);
        tbRecetas.getColumnModel().getColumn(9).setMaxWidth(0);
        tbRecetas.getColumnModel().getColumn(10).setPreferredWidth(40);

        jPanel4.setBackground(new java.awt.Color(204, 204, 255));
        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(""));

        cbxBuscador.setFont(new java.awt.Font("Cambria", 0, 14)); // NOI18N
        cbxBuscador.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbxBuscadorActionPerformed(evt);
            }
        });

        txtBuscador.setFont(new java.awt.Font("Cambria", 0, 14)); // NOI18N
        txtBuscador.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                txtBuscadorMouseClicked(evt);
            }
        });
        txtBuscador.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                txtBuscadorKeyReleased(evt);
            }
        });

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/lupa.png"))); // NOI18N

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(cbxBuscador, javax.swing.GroupLayout.PREFERRED_SIZE, 216, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtBuscador)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel1)
                .addContainerGap())
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1)
                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(cbxBuscador, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(txtBuscador, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout panel1Layout = new javax.swing.GroupLayout(panel1);
        panel1.setLayout(panel1Layout);
        panel1Layout.setHorizontalGroup(
            panel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panel1Layout.createSequentialGroup()
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(jPanel4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 948, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jScrollPane1)))
        );
        panel1Layout.setVerticalGroup(
            panel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panel1Layout.createSequentialGroup()
                .addGap(0, 0, Short.MAX_VALUE)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 249, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(panel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(panel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnNuevoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNuevoActionPerformed
        jMessageComboBox.showMessageComboBox("Seleccione el Tipo de Receta");
        if (jMessageComboBox.btnAceptar) {
            if (jMessageComboBox.tipoReceta.equals("Simple")) {
                lblModeloReceta.setText("Simple");
                clsRecetaSimple.Insertar_Receta("", "", 0, 0, 0, "Simple", 1, "habilitado", "");
                btnAgregarComplementaria.setEnabled(false);
                cbxComplementario.setEnabled(false);
            } else {
                lblModeloReceta.setText("Compuesta");
                clsRecetaSimple.Insertar_Receta("", "", 0, 0, 0, "Compuesta", 1, "habilitado", "");
                btnAgregarComplementaria.setEnabled(true);
                cbxComplementario.setEnabled(true);
            }

            IdRecetaSimple = clsRecetaSimple.obtener_idRecetaSimple();
            clsTipoReceta.cargarTipoReceta(cbxTipoReceta);
            clsIngrediente.cargarListaIngredientes(cbxIngrediente, IdRecetaSimple);
            this.limpiar_campos();
            this.ponerFotoEnableb();
            direcciones.clear();
            listaNombre.clear();
            this.set_enableTodoNuevo();
            clsTipoReceta.cargarTipoRecetaBuscador(cbxBuscador);
            txtBuscador.setText("");
            lblCostoReceta.setText("0");
            lblValorProteico.setText("0");
            Global.costoTotalComplem = 0;
            Global.costoTotalSimple = 0;
            Global.valorTotalComplem = 0;
            Global.valorTotalSimple = 0;
            costoTotal = 0;
            valorProteico = 0;
            btnModificar.setEnabled(false);
            btnEliminar.setEnabled(false);
            btnCancelar.setEnabled(true);
            btnGuardar.setEnabled(true);
            btnNuevo.setEnabled(false);
            lblCargarImagenes.setEnabled(true);
            isHabilitado = true;
            this.hacerVisibleCamposObligatorios();
        }
    }//GEN-LAST:event_btnNuevoActionPerformed

    private void btnModificarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnModificarActionPerformed

        if (this.estanCamposObligatoriosLlenos()) {  //verifica que todos los campos obligatorios esten llenos
            String nombre = txtNombre.getText();
            String preparacion = pnlPreparacion.getText();
            float costoTo = Float.parseFloat(lblCostoReceta.getText());
            float valorPro = Float.parseFloat(lblValorProteico.getText());
            int tipo = clsTipoReceta.obtener_idTipoReceta(cbxTipoReceta.getSelectedItem().toString());
            float rendimiento = (txtPorciones.getText().equals("")) ? 0 : Float.parseFloat(txtPorciones.getText());
            String modelo = lblModeloReceta.getText();
            String unidad = cbxUnidad.getSelectedItem().toString();

            clsRecetaSimple.modificar_tipoReceta(IdRecetaSimple, nombre, preparacion, costoTo, valorPro, rendimiento, modelo, tipo, "habilitado", unidad);

            //actualizar la tabla de recetas
            tbRecetas.setValueAt(IdRecetaSimple, fila, 0);
            tbRecetas.setValueAt(nombre, fila, 1);
            tbRecetas.setValueAt(cbxTipoReceta.getSelectedItem().toString(), fila, 2);
            tbRecetas.setValueAt(preparacion, fila, 3);
            tbRecetas.setValueAt(costoTo, fila, 4);
            tbRecetas.setValueAt(valorPro, fila, 5);
            tbRecetas.setValueAt(rendimiento, fila, 6);
            tbRecetas.setValueAt(modelo, fila, 7);
            tbRecetas.setValueAt(unidad, fila, 10);

            Global.costoTotalComplem = 0;
            Global.costoTotalSimple = 0;
            Global.valorTotalComplem = 0;
            Global.valorTotalSimple = 0;

            jMessageFlush.showMessageFlush("Receta Modificada Correctamente", jMessageFlush.shortTime, jMessageFlush.Confirmation);

        } else {
            this.hacerVisibleCamposObligatorios();
            jMessageFlush.showMessageFlush("Existen campos obligatorios", jMessageFlush.shortTime, jMessageFlush.Warning);
        }
    }//GEN-LAST:event_btnModificarActionPerformed

    private void btnGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGuardarActionPerformed
        if (this.estanCamposObligatoriosLlenos()) {
            String nombre = Global.enFormato(txtNombre.getText().toUpperCase());
            String preparacion = Global.enFormato(pnlPreparacion.getText().toUpperCase());
            float costoTo = Float.parseFloat(lblCostoReceta.getText());
            float valorPro = Float.parseFloat(lblValorProteico.getText());
            int tipo = clsTipoReceta.obtener_idTipoReceta(cbxTipoReceta.getSelectedItem().toString());
            float rendimiento = (txtPorciones.getText().equals("")) ? 0 : Float.parseFloat(txtPorciones.getText());
            String modelo = lblModeloReceta.getText().toUpperCase();
            String unidad = cbxUnidad.getSelectedItem().toString().toUpperCase();

            clsRecetaSimple.modificar_tipoReceta(IdRecetaSimple, nombre, preparacion, costoTo, valorPro, rendimiento, modelo, tipo, "habilitado", unidad);
            this.agregar_aTablaRecetasSimples(IdRecetaSimple, nombre, cbxTipoReceta.getSelectedItem().toString(), preparacion, costoTo, valorPro, rendimiento, modelo, unidad);

            this.limpiar_campos();
            this.deshabilitarCampos();
            direcciones.clear();
            listaNombre.clear();
            this.ponerFotoEnableb();
            this.isHabilitado = false;
            cbxIngrediente.removeAllItems();
            lblModeloReceta.setText("");
            btnModificar.setEnabled(false);
            btnNuevo.setEnabled(true);
            btnGuardar.setEnabled(false);
            btnCancelar.setEnabled(false);
            lblCargarImagenes.setEnabled(false);
            hacerVisibleCamposObligatorios();
        } else {
            jMessageFlush.showMessageFlush("Existen campos obligatorios que debe llenar", jMessageFlush.shortTime, jMessageFlush.Warning);
        }
    }//GEN-LAST:event_btnGuardarActionPerformed

    private void btnCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelarActionPerformed

        clsRecetaSimple.eliminar_RecetaSimple(IdRecetaSimple);
        this.limpiar_campos();
        this.deshabilitarCampos();
        btnModificar.setEnabled(false);
        btnEliminar.setEnabled(false);
        btnNuevo.setEnabled(true);
        btnGuardar.setEnabled(false);
        btnCancelar.setEnabled(false);
        lblModeloReceta.setText("");
        lblCargarImagenes.setEnabled(false);
        isHabilitado = false;
        Global.costoTotalComplem = 0;
        Global.costoTotalSimple = 0;
        Global.valorTotalComplem = 0;
        Global.valorTotalSimple = 0;
    }//GEN-LAST:event_btnCancelarActionPerformed

    private void txtNombreKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtNombreKeyTyped
        lblObligatorio1.setVisible((txtNombre.getText().equals("") ? true : false));
    }//GEN-LAST:event_txtNombreKeyTyped

    private void pnlPreparacionKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_pnlPreparacionKeyTyped

        lblObligatorio3.setVisible(pnlPreparacion.getText().equals("") ? true : false);
    }//GEN-LAST:event_pnlPreparacionKeyTyped

    private void txtPorcionesMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_txtPorcionesMouseClicked
        txtPorciones.setText("");
    }//GEN-LAST:event_txtPorcionesMouseClicked

    private void txtPorcionesKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtPorcionesKeyTyped
        Global.validarNumero(9, evt, txtPorciones);
    }//GEN-LAST:event_txtPorcionesKeyTyped

    private void CerrarVentanaReceta(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_CerrarVentanaReceta
        if (isHabilitado) {
            clsRecetaSimple.eliminar_RecetaSimple(IdRecetaSimple);
        }
    }//GEN-LAST:event_CerrarVentanaReceta

    private void btnAgregarIngredienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAgregarIngredienteActionPerformed

        costoTotal = 0;
        valorProteico = 0;
        new frmAgregarIngrediente(null, true).setVisible(true);

        // para actualizar la tabla recetas una vez se haya modificado los ingredientes, se actualiza el costo total y el valor proteico
        if (this.estanCamposObligatoriosLlenos()) {  //verifica que todos los campos obligatorios esten llenos
            String nombre = txtNombre.getText();
            String preparacion = pnlPreparacion.getText();
            float costoTo = Float.parseFloat(lblCostoReceta.getText());
            float valorPro = Float.parseFloat(lblValorProteico.getText());
            int tipo = clsTipoReceta.obtener_idTipoReceta(cbxTipoReceta.getSelectedItem().toString());
            float rendimiento = (txtPorciones.getText().equals("")) ? 0 : Float.parseFloat(txtPorciones.getText());
            String modelo = lblModeloReceta.getText();
            String unidad = cbxUnidad.getSelectedItem().toString();

            clsRecetaSimple.modificar_tipoReceta(IdRecetaSimple, nombre, preparacion, costoTo, valorPro, rendimiento, modelo, tipo, "habilitado", unidad);

            //actualizar la tabla de recetas
            tbRecetas.setValueAt(IdRecetaSimple, fila, 0);
            tbRecetas.setValueAt(nombre, fila, 1);
            tbRecetas.setValueAt(cbxTipoReceta.getSelectedItem().toString(), fila, 2);
            tbRecetas.setValueAt(preparacion, fila, 3);
            tbRecetas.setValueAt(costoTo, fila, 4);
            tbRecetas.setValueAt(valorPro, fila, 5);
            tbRecetas.setValueAt(rendimiento, fila, 6);
            tbRecetas.setValueAt(modelo, fila, 7);
            tbRecetas.setValueAt(unidad, fila, 10);

        } else {
            this.hacerVisibleCamposObligatorios();
        }
        lblObligatorio2.setVisible((cbxIngrediente.getItemCount() == 0) ? true : false);

    }//GEN-LAST:event_btnAgregarIngredienteActionPerformed

    private void jPanel1MouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel1MouseMoved
        // continuar=false;
        hiloHabilitado = false;
        if (direcciones.size() > 0) {
            ImageIcon img = new ImageIcon(direcciones.get(0).toString());
            Image image = img.getImage().getScaledInstance(145, 120, Image.SCALE_AREA_AVERAGING);
            lblCargarImagenes.setIcon(new ImageIcon(image));
        }

        lblVerImagenes.setForeground(Color.BLACK);
        lblRecetasInhabilitada.setForeground(Color.BLACK);
        lblCargarImagenes.setForeground(Color.BLACK);
    }//GEN-LAST:event_jPanel1MouseMoved

    private void btnAgregarTipoRecetaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAgregarTipoRecetaActionPerformed
        new frmTipoReceta(null, true).setVisible(true);
        clsTipoReceta.cargarTipoReceta(cbxTipoReceta);
        if (frmTipoReceta.fila == 0) {  //cargo el cbx con items seleccionado en el frmTipoReceta
            cbxTipoReceta.setSelectedItem(frmTipoReceta.tbTipoReceta.getValueAt(frmTipoReceta.tbTipoReceta.getRowCount() - 1, 1));  //toma el ultimo item
        } else {
            cbxTipoReceta.setSelectedItem(frmTipoReceta.tbTipoReceta.getValueAt(frmTipoReceta.fila, 1));  //toma el item seleccionado
        }
    }//GEN-LAST:event_btnAgregarTipoRecetaActionPerformed

    private void lblVerImagenesMouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblVerImagenesMouseMoved
        lblVerImagenes.setForeground(Color.LIGHT_GRAY);

    }//GEN-LAST:event_lblVerImagenesMouseMoved

    private void lblVerImagenesMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblVerImagenesMouseClicked
        clsFotoReceta.obtener_listaFotosRecetas(IdRecetaSimple);
        new frmVisor(null, true).setVisible(true);
        lblVerImagenes.setForeground(Color.BLACK);
    }//GEN-LAST:event_lblVerImagenesMouseClicked

    private void lblCargarImagenesMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblCargarImagenesMouseClicked
        buscar.setMultiSelectionEnabled(true);
        int seleccion = buscar.showOpenDialog(buscar);
        if (seleccion == JFileChooser.APPROVE_OPTION) {
            File[] fichero = buscar.getSelectedFiles();
            for (int i = 0; i < fichero.length; i++) {
                if (!frmVisor.existeEstaImegen(fichero[i])) {
                    String nombre = fichero[i].getName();
                    String direccion = fichero[i].getAbsolutePath();
                    listaNombre.add(nombre);
                    direcciones.add(fichero[i].getAbsoluteFile());
                    clsFotoReceta.insertar_fotoReceta(nombre, direccion, IdRecetaSimple);
                }
            }
            ImageIcon img = new ImageIcon(direcciones.get(0).toString());
            Image image = img.getImage().getScaledInstance(145, 120, Image.SCALE_AREA_AVERAGING);
            lblCargarImagenes.setIcon(new ImageIcon(image));
            hiloHabilitado = false;
        } else {
            buscar.cancelSelection();
        }
    }//GEN-LAST:event_lblCargarImagenesMouseClicked

    private void lblCargarImagenesMouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblCargarImagenesMouseMoved
//        continuar=true;
        if (!hiloHabilitado) {
            lblCargarImagenes.setForeground(Color.LIGHT_GRAY);
            hiloHabilitado = true;
        }
    }//GEN-LAST:event_lblCargarImagenesMouseMoved

    private void tbRecetasMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tbRecetasMouseClicked
        if (isHabilitado) {
            clsRecetaSimple.eliminar_RecetaSimple(IdRecetaSimple);
            isHabilitado = false;
        }
        this.set_enableTodoNuevo();

        fila = tbRecetas.rowAtPoint(evt.getPoint());
        IdRecetaSimple = Integer.parseInt(String.valueOf(tbRecetas.getValueAt(fila, 0)));
        String nombre = tbRecetas.getValueAt(fila, 1).toString();
        String tipo = tbRecetas.getValueAt(fila, 2).toString();
        String preparacion = tbRecetas.getValueAt(fila, 3).toString();
        String costoTot = tbRecetas.getValueAt(fila, 4).toString();
        String valorProt = tbRecetas.getValueAt(fila, 5).toString();
        String rendimiento = tbRecetas.getValueAt(fila, 6).toString();
        String modelo = tbRecetas.getValueAt(fila, 7).toString();
        String unidad = tbRecetas.getValueAt(fila, 10).toString();

        txtNombre.setText(nombre);
        txtPorciones.setText(rendimiento);
        pnlPreparacion.setText(preparacion);
        lblCostoReceta.setText(costoTot);
        lblValorProteico.setText(valorProt);
        lblModeloReceta.setText(modelo);
        clsIngrediente.cargarListaIngredientes(cbxIngrediente, IdRecetaSimple);
        clsTipoReceta.cargarTipoReceta(cbxTipoReceta);
        cbxTipoReceta.setSelectedItem(tipo);
        cbxUnidad.setSelectedItem(unidad);
        clsFotoReceta.obtener_listaFotosRecetas(IdRecetaSimple);

        this.hacerVisibleCamposObligatorios();
        btnGuardar.setEnabled(false);
        btnCancelar.setEnabled(false);
        btnNuevo.setEnabled(true);
        btnEliminar.setEnabled(true);
        btnModificar.setEnabled(true);
        lblCargarImagenes.setEnabled(true);

        Global.costoTotalComplem=clsRecetaSimple.getCostoTotalReceta(IdRecetaSimple);
        Global.costoTotalSimple=clsIngrediente.getCostoTotalIngrediente(IdRecetaSimple);
        Global.valorTotalComplem=clsRecetaSimple.getValorProteicoReceta(IdRecetaSimple);
        Global.valorTotalSimple=clsIngrediente.getValorProteicoIngrediente(IdRecetaSimple);
        
        if (modelo.equals("Compuesta")) {
            clsRecetaCompuesta.cargarLista_recetaComplemetaria(cbxComplementario, IdRecetaSimple);
            btnAgregarComplementaria.setEnabled(true);
            cbxComplementario.setEnabled(true);
        } else {
            btnAgregarComplementaria.setEnabled(false);
            cbxComplementario.setEnabled(false);
        }

    }//GEN-LAST:event_tbRecetasMouseClicked

    private void btnEliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEliminarActionPerformed
        if (tbRecetas.getRowCount() > 0) {
            clsRecetaSimple.deshabilitar_receta(IdRecetaSimple, "deshabilitado");
            DefaultTableModel dtmLista = (DefaultTableModel) tbRecetas.getModel();
            dtmLista.removeRow(fila);

            this.limpiar_campos();
            this.deshabilitarCampos();
            cbxIngrediente.removeAllItems();
            lblModeloReceta.setText("");
            btnEliminar.setEnabled(false);
            btnModificar.setEnabled(false);
            lblCargarImagenes.setEnabled(false);

            Global.costoTotalComplem = 0;
            Global.costoTotalSimple = 0;
            Global.valorTotalComplem = 0;
            Global.valorTotalSimple = 0;
        }
    }//GEN-LAST:event_btnEliminarActionPerformed

    private void cbxBuscadorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbxBuscadorActionPerformed
        if (clsTipoReceta.isBuscador) {
            String tipoReceta = cbxBuscador.getSelectedItem().toString();
            String sql;  //para cargar la tabla segun seleccione  el tipo de receta del CBX
            if (tipoReceta.equals("Ver Todos")) {
                sql = "CALL `obtener_ListaRecetasSimp`(" + 0 + ")";
            } else {
                sql = "CALL `buscador_RecetaSimple`(" + "''," + '"' + tipoReceta + '"' + "," + 1 + ")";
            }
            clsRecetaSimple.mostrarTablaRecetasSimples(tbRecetas, sql);
        }
    }//GEN-LAST:event_cbxBuscadorActionPerformed

    private void txtBuscadorKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtBuscadorKeyReleased
        String NombreReceta = txtBuscador.getText();
        String tipoReceta = cbxBuscador.getSelectedItem().toString();
        String sql; //para cargar la tabla segun vaya tecleando
        if (tipoReceta.equals("Ver Todos")) {
            sql = "CALL`buscador_RecetaSimple`(" + '"' + NombreReceta + '"' + ",''," + 3 + ")";
        } else {
            sql = "CALL`buscador_RecetaSimple`(" + '"' + NombreReceta + '"' + "," + '"' + tipoReceta + '"' + "," + 2 + ")";
        }
        clsRecetaSimple.mostrarTablaRecetasSimples(tbRecetas, sql);
    }//GEN-LAST:event_txtBuscadorKeyReleased

    private void txtBuscadorMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_txtBuscadorMouseClicked
        txtBuscador.setText("");
    }//GEN-LAST:event_txtBuscadorMouseClicked

    private void lblRecetasInhabilitadaMouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblRecetasInhabilitadaMouseMoved
        lblRecetasInhabilitada.setForeground(Color.LIGHT_GRAY);

    }//GEN-LAST:event_lblRecetasInhabilitadaMouseMoved

    private void lblRecetasInhabilitadaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblRecetasInhabilitadaMouseClicked
        new frmRecetasEliminada(null, true).setVisible(true);
        this.cargarTablaReceta();
        lblRecetasInhabilitada.setForeground(Color.BLACK);
    }//GEN-LAST:event_lblRecetasInhabilitadaMouseClicked

    private void btnAgregarComplementariaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAgregarComplementariaActionPerformed
        costoTotal = 0;
        valorProteico = 0;
        new frmAgregarRecetaSimple(null, true).setVisible(true);
    }//GEN-LAST:event_btnAgregarComplementariaActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(frmReceta.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(frmReceta.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(frmReceta.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(frmReceta.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the dialog */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                frmReceta dialog = new frmReceta(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    @Override
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JToolBar ToolBarAcciones;
    private javax.swing.JButton btnAgregarComplementaria;
    private javax.swing.JButton btnAgregarIngrediente;
    private javax.swing.JButton btnAgregarTipoReceta;
    private javax.swing.JButton btnCancelar;
    private javax.swing.JButton btnEliminar;
    private javax.swing.JButton btnGuardar;
    private javax.swing.JButton btnModificar;
    private javax.swing.JButton btnNuevo;
    private javax.swing.JComboBox cbxBuscador;
    public static javax.swing.JComboBox cbxComplementario;
    public static javax.swing.JComboBox cbxIngrediente;
    private javax.swing.JComboBox cbxTipoReceta;
    private javax.swing.JComboBox cbxUnidad;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JLabel label1;
    private javax.swing.JLabel label2;
    private javax.swing.JLabel label3;
    private javax.swing.JLabel label4;
    private javax.swing.JLabel label5;
    private javax.swing.JLabel label6;
    private javax.swing.JLabel lblCargarImagenes;
    public static javax.swing.JLabel lblCostoReceta;
    private javax.swing.JLabel lblModeloReceta;
    private javax.swing.JLabel lblObligatorio1;
    public static javax.swing.JLabel lblObligatorio2;
    private javax.swing.JLabel lblObligatorio3;
    private javax.swing.JLabel lblRecetasInhabilitada;
    public static javax.swing.JLabel lblValorProteico;
    private javax.swing.JLabel lblVerImagenes;
    private org.edisoncor.gui.panel.Panel panel1;
    private javax.swing.JTextPane pnlPreparacion;
    private javax.swing.JTable tbRecetas;
    private javax.swing.JTextField txtBuscador;
    public static javax.swing.JTextField txtNombre;
    private javax.swing.JTextField txtPorciones;
    // End of variables declaration//GEN-END:variables

    private void deshabilitarCampos() {
        txtNombre.setEnabled(false);
        txtPorciones.setEnabled(false);
        cbxTipoReceta.setEnabled(false);
        cbxIngrediente.setEnabled(false);
        pnlPreparacion.setEnabled(false);
        btnAgregarIngrediente.setEnabled(false);
        btnAgregarTipoReceta.setEnabled(false);
        btnAgregarComplementaria.setEnabled(false);
        cbxComplementario.setEnabled(false);
        lblCargarImagenes.setEnabled(false);
        cbxUnidad.setEnabled(false);
    }

    private void set_enableTodoNuevo() {
        txtNombre.setEnabled(true);
        txtPorciones.setEnabled(true);
        cbxTipoReceta.setEnabled(true);
        cbxIngrediente.setEnabled(true);
        pnlPreparacion.setEnabled(true);
        btnAgregarIngrediente.setEnabled(true);
        btnAgregarTipoReceta.setEnabled(true);
        cbxUnidad.setEnabled(true);
    }

    private void limpiar_campos() {
        lblCostoReceta.setText("");
        txtNombre.setText("");
        txtPorciones.setText("");
        lblValorProteico.setText("");
        pnlPreparacion.setText("");
        cbxComplementario.removeAllItems();
    }

    private boolean estanCamposObligatoriosLlenos() {
        return (!txtNombre.getText().equals("") && cbxIngrediente.getItemCount() > 0 && !pnlPreparacion.getText().equals("")) ? true : false;
    }

    private void hacerVisibleCamposObligatorios() {
        lblObligatorio1.setVisible((txtNombre.getText().equals("")) ? true : false);
        lblObligatorio2.setVisible((cbxIngrediente.getItemCount() == 0) ? true : false);
        lblObligatorio3.setVisible((pnlPreparacion.getText().equals("")) ? true : false);
    }

    @Override
    public void run() {
        while (true) {
            for (int i = 0; i < direcciones.size(); i++) {
                if (hiloHabilitado) {
                    try {
                        ImageIcon img = new ImageIcon(direcciones.get(i).toString());
                        Image image = img.getImage().getScaledInstance(177, 135, Image.SCALE_AREA_AVERAGING);
                        lblCargarImagenes.setIcon(new ImageIcon(image));
                        Thread.sleep(1000);
                    } catch (InterruptedException ex) {
                        System.out.println("error en el hilo");
                    }
                } else {
                    if (direcciones.size() > 0) {
                        ImageIcon img = new ImageIcon(direcciones.get(0).toString());
                        Image image = img.getImage().getScaledInstance(145, 120, Image.SCALE_AREA_AVERAGING);
                        lblCargarImagenes.setIcon(new ImageIcon(image));
                    }
                }
            }
            if (direcciones.isEmpty()) {
                ImageIcon img = new ImageIcon(getClass().getResource("/imagenes/picture2.png"));
                Image image = img.getImage().getScaledInstance(145, 120, Image.SCALE_AREA_AVERAGING);
                lblCargarImagenes.setIcon(new ImageIcon(image));
            }
        }
    }

    private void agregar_aTablaRecetasSimples(int IdRecetSimp, String nombre, String tipo, String preparacion, float costoTo, float valorPro, float rendimiento, String modelo, String unidad) {
        Object[] o = new Object[11];
        o[0] = IdRecetSimp;
        o[1] = nombre;
        o[2] = tipo;
        o[3] = preparacion;
        o[4] = costoTo;
        o[5] = valorPro;
        o[6] = rendimiento;
        o[7] = modelo;
        o[10] = unidad;

        DefaultTableModel dtmLista = (DefaultTableModel) tbRecetas.getModel();
        dtmLista.addRow(o);
    }

    private void cargarTablaReceta() {
        String sql = "CALL `obtener_listaRecetasSimp`(" + 0 + ")";
        clsRecetaSimple.mostrarTablaRecetasSimples(tbRecetas, sql);
    }

    private void ponerFotoEnableb() {
        ImageIcon img = new ImageIcon(getClass().getResource("/imagenes/picture2.png"));
        Image image = img.getImage().getScaledInstance(145, 120, Image.SCALE_AREA_AVERAGING);
        lblCargarImagenes.setIcon(new ImageIcon(image));
    }

    private void cargarCbxBuscador() {
        clsTipoReceta.cargarTipoRecetaBuscador(cbxBuscador);
    }
}
